package it.polimi.swKnights.SWIMv2.servlets.help;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class HelpRequestController
 */
public class HelpRequestController extends HttpServlet
{
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException
	{
		String parameter = "";
		parameter = (String) request.getAttribute("status");
		if (parameter == null)
			parameter = "";
		else
			parameter = "?status=" + parameter;

		if("true".equals(request.getParameter("helpSent")))
		{
			request.setAttribute("message", "Request has been correctly sent");
		}
		
		request.getRequestDispatcher("WEB-INF/help/helpRequest.jsp" + parameter)
				.forward(request, response);

	}

}
